<html>
  <head>
    <title>AJAX and Dojo toolkit</title>
    <script src="http://o.aolcdn.com/dojo/1.4/dojo/dojo.xd.js">
    </script>
    <script type="text/javascript">
      function printUsers(){
        dojo.xhrGet({
          url: "files/subscribers.xml",
          handleAs: "xml",
          load: function(response){
            var results = dojo.byId("results");
            results.innerHTML = "";
            var names = response.getElementsByTagName("name");
            var emails = response.getElementsByTagName("email");
            for (var i = 0; i < 3; i++){
              results.innerHTML += names[i].childNodes[0].nodeValue;
              results.innerHTML += "<br/>";
              results.innerHTML += emails[i].childNodes[0].nodeValue;
              results.innerHTML += "<br/>";
            }           
          },
          error: function(error){
            alert("oops: "+error);
          }     
       });
      }
    </script>
  </head>
  <body>
    <button onclick="printUsers()">List Users</button>
    <br /><br />
    <div id="results">
    </div>
  </body>
</html>